<?php 

namespace app\api\validate;

use think\Validate;
use think\Request;
use think\Exception;
use app\lib\exception\BannerMissException;
use app\lib\exception\ParameterException;
/**
 * 
 */
class BaseValidate extends Validate
{
	public function goCheck()
	{
		// 获取http传入的参数
		$request = Request::instance();
		$param = $request->param();
		// 对这些参数做检验
		$res = $this->check($param);
		if(!$res) {
			$error = new ParameterException();
			$error->msg = $this->error;
			throw $error;
			// $error = $this->error;
			// throw new BannerMissException; // tp默认异常
		} else {
			return true;
		}
	}
}